<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>培训机构主页</title>


    <!-- Expand styles -->
    <link href="../css/app/app.css" rel="stylesheet">
    <link href="../css/app/default.css" rel="stylesheet">
    <link href="../css/mui/mui.css" rel="stylesheet">


</head>

<body>

    <!-- header -->
    <div>
        <div class="margin-b-10">
            <div class="widget-default widget-body margin-b-1 padding-b-10">
                <div class="display-flex align-items-center justify-content-end padding-b-10">
                    <img class="expert-address" src="../img/expert-address.png" alt="">
                    <span class="gray font-13 address"></span>
                </div>
                <div class="position-img">
                    <img class="headPortrait" src="../img/video-bg.png" alt="" style="border-radius:50%">
                    <img src="../img/v.png" alt="">
                </div>
                <p class="black1 font-16 text-center font-weight padding-t-10 userName"></p>
                <div class="padding-b-5 text-center serviceType display-flex flex-warp ">

                </div>
            </div>
            <div class="display-flex justify-content-between widget-default padding-5-15">
                <div class="display-flex flex-column align-items-center width50 border-r padding-l-15">
                    <span class="black font-15 serviceNum"></span>
                    <span class="gray font-12">服务次数</span>
                </div>
                <div class="display-flex flex-column align-items-center width50 padding-r-15">
                    <span class="black font-15 servicePersonNum"></span>
                    <span class="gray font-12">服务人数</span>
                </div>
            </div>
        </div>
        <!-- 内容 -->
        <div class="margin-b-10">
            <div class="widget-default widget-body px-border-l margin-b-1">
                <span class="black font-15 font-weight">机构简介</span>
            </div>
            <div class="widget-default widget-body padding-t-5">
                <p class="gray font-12 no-margin introduction">
                </p>
            </div>
        </div>
        <div class="margin-b-10">
            <div class="widget-default widget-body px-border-l margin-b-1">
                <span class="black font-15 font-weight">资质证书</span>
            </div>
            <div class="widget-default widget-body padding-t-5 credentials">

            </div>
        </div>
        <div class="margin-b-10">
            <div class="widget-default widget-body px-border-l margin-b-1">
                <span class="black font-15 font-weight">线下服务案例</span>
            </div>
            <div class="onlineList">

            </div>
        </div>

    </div>
    <script src="../js/dsbridge.js"></script>
    <script src="../js/jquery.js"></script>
    <script src="../js/mui/mui.js"></script>
    <script src="../js/mui/mui.picker.min.js"></script>
    <script src="../js/layer.js"></script>
    <script src="../js/city.data-3.js"></script>
    <script src="../js/app/app-base.js"></script>
    <script src="../js/app/app-url.js"></script>
    <script src="../js/app/app-ajax.js"></script>
    <script>
        var trainOrganizationDetails = {
            id: localStorage.getItem('trainOrganizationId'),
            userAccId: getUserId(),
        }
        var offLineList = {
            orgUserAccId: localStorage.getItem('trainOrganizationUserAccId'),
            page: 1,
            limit: 9999
        }
        $(document).ready(function () {
            getServerData(url_trainorgmgr_getTrainOrganizationDetails, trainOrganizationDetails)
            getServerData(url_queryOffLineList, offLineList)

        });

        function getServerDataSuccess(url, data) {
            switch (url) {
                //详情
                case url_trainorgmgr_getTrainOrganizationDetails:
                    $('.userName').html(data.data.userName)
                    $('.introduction').html(data.data.introduction)
                    $('.serviceNum').html(data.data.serviceNum)
                    $('.servicePersonNum').html(data.data.servicePersonNum)

                    var address = data.data.province.provinceName;
                    if (!isEmpty(data.data.city))
                        address += data.data.city.cityName;
                    if (!isEmpty(data.data.county))
                        address += data.data.county.countyName;
                    if (!isEmpty(data.data.tranAddress))
                        address += data.data.tranAddress;
                    $('.address').html(address)
                    var s = ''
                    data.data.serviceType.map(item => {
                        s += '<span class="tuli-content1 font-15 tuli-bg" style="margin-right: 5px;"  >' + item
                            .name + '</span>'
                    })
                    $('.headPortrait').attr('src', showSmallImg(data.data.headPortrait))
                    $('.serviceType').html(s)
                    var imgs = ''
                    data.data.credentials.map(item => {
                        imgs += '<img style="width: 100%;height: 177px;margin-bottom: 10px;" src="' + (isEmpty(
                            item.pictureVideoId) ? "../img/headimg.png" : showSmallImg(item
                            .pictureVideoId)) + '" alt="">'
                    })
                    $('.credentials').html(imgs)
                    break;
                case url_queryOffLineList:
                    var html_data = "";
                    for (var i = 0; i < data.data.length; i++) {
                        var tranType = "";
                        if (data.data[i].tranType != null) {
                            tranType = data.data[i].tranType.name;
                        }
                        html_data +=
                            '<div class="widget-default widget-body display-flex margin-b-3 padding-b-10 case-details" id="' +
                            data.data[i].id + '">' +
                            ' <div class="position-img-l2">' +
                            '<img src="' + (isEmpty(data.data[i].img) ? "../img/bg_default.png" : showSmallImg(data
                                .data[i].img)) + '" alt="">' +
                            ' <img src="../img/v.png" alt="">' +
                            '</div>' +
                            ' <div class="display-flex flex-column margin-l-10 margin-t-f5">' +
                            '<p class="no-margin font-16 font-weight black1 elli1">' + data.data[i].title + '</p>' +
                            '  <div class="padding-t-5 padding-b-5">' +
                            '<span class="tuli-content1 font-15 tuli-bg" style="margin-right: 5px;"  >' + tranType +
                            '</span>' +
                            '  </div>' +
                            '      <p class="font-12 gray no-margin line-height-18">主办方：' + data.data[i].tranSponsors +
                            '</p>' +
                            ' <p class="font-12 gray no-margin line-height-18">' +
                            '     ' + data.data[i].tranBeginTime + '<span>&nbsp;&nbsp;~&nbsp;&nbsp;</span>' + data.data[
                                i].tranEndTime + '</p>' +
                            ' </div>' +
                            ' </div>'
                    }
                    $('.onlineList').html(html_data)

                    break;

            }
        }

        mui(".onlineList").on('tap', '.case-details', function () {
            localStorage.setItem("case-id", $(this).attr("id"));
            dsBridge.call("details");
        });
    </script>

</body>

</html>